package com.htthorizon.gateway.task;

import cn.hutool.core.date.DateTime;

import com.htthorizon.common.redis.service.RedisService;
import com.htthorizon.system.api.domain.SysOperLog;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Collection;

/**
 * @author Brilliant
 */
@Component
@Slf4j
public class DATASync {


    @Autowired
    private RedisService redisService;

    @Scheduled(cron = "*/5 * * * * *")
    public void task() throws Exception {
        Collection<String> keys = redisService.keys("loginfo:*");
        for (String key: keys){
            Object cacheObject = redisService.getCacheObject(key);
            log.info(cacheObject.toString()+"\"访问服务:【zh-cyhsj-wggl-wggl】\"");
            redisService.deleteObject(key);
        }
    }
}
